import axios from "axios";
import type {AxiosResponse} from "axios"
const service = axios.create({
    baseURL: "http://121.89.205.189:3000/admin",
    timeout: 10000
})
service.interceptors.request.use((config)=>{
    const token = localStorage.getItem("token");   //存储的方式
    if(token) {
        config.headers.token = token;    //  存储访问的数据
    }
    return config;
})
service.interceptors.response.use((res: AxiosResponse) => {
    return res;
}, (err) => {
    if (err.response.status === 404) {
        console.log("没有找到");
    }
})

export default service;